<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"
	    xmlns:p="http://primefaces.org/ui"
		xmlns:c="http://java.sun.com/jsp/jstl/core">

	<ui:composition>
	
		<c:if test="${empty columns}">
			<c:set var="columns" value="2" />
		</c:if>

		<c:if test="${empty renderNewButton}">
			<c:set var="renderNewButton" value="true" />
		</c:if>
		
		<f:facet name="header">
			<h:outputText value="#{label}" />
		</f:facet>
		
		<!-- Set entity variable. -->
		<c:set var="entity" value="#{backingBean.instance}" />
		
		<h:form id="searchForm" styleClass="mainForm" >
			<h:panelGrid columns="#{columns}">
				<ui:insert />
			</h:panelGrid>
			<h:panelGrid columns="3">
				<p:commandButton id="buttonSearch" value="#{messages['commons.search']}" ajax="false" action="#{backingBean.search}" />
				<p:commandButton id="buttonClear" action="#{backingBean.clean}" value="#{messages['commons.clean']}" ajax="false"/>
				<p:button id="buttonNew" value="#{messages['commons.new']}" outcome="#{backingBean.getNewViewName()}" render="#{renderNewButton}"> 
					<f:param name="edit" value="true"/>
				</p:button>
			</h:panelGrid>
		</h:form>
	    
    </ui:composition>

</html>
